﻿using DevExpress.XtraReports.UI;
using Devices;
using System.Collections.Generic;
using System.IO;

namespace DevicesView.Print
{


    public class HospitalPrint : IPrint, DevicesView.Logic.Print.IPrintExpand
    {
        private string PrintClassName => "二唯码打印";
        private PrintInfo info;
        public PrintInfo PrintInfo
        {
            get
            {
                if (info == null)
                {
                    info = new PrintInfo(true);
                    info.Dll = "DevicesView.Print.dll";
                    info.ClassName = "DevicesView.Print.HospitalPrint";
                    info.Name = "二唯码打印";
                }
                return info;
            }
            set {
                info = value;
            }
        }

        public void Preview(List<Result> result)
        {
            LabReportA4 labReportA4 = new LabReportA4(result);
            labReportA4.ShowPreviewDialog();
        }


        public void Print(List<Result> result)
        {
            LabReportA4 labReportA4 = new LabReportA4(result);
            labReportA4.Print();
        }

        public void Print(List<Result> result, string PrinterName)
        {
            LabReportA4 labReportA4 = new LabReportA4(result);
            labReportA4.Print(PrinterName);
        }

        public void Preview(List<Result> result, string PrinterName)
        {
            LabReportA4 labReportA4 = new LabReportA4(result);
            labReportA4.ShowPreview();
        }

        public void PrintToPDF(string pdfPath, List<Result> result)
        {
            throw new System.NotImplementedException();
        }

        public Stream PrintToPDF(List<Result> result)
        {
            LabReportA4 labReportA4 = new LabReportA4(result);
            Stream sm = new MemoryStream();
            labReportA4.ExportToPdf(sm);
            return sm;
        }
    }
}
